<template>
    <view class="main-pd u-p-t-20">
        <view class="u-card" v-for="person in personArr" :key="person.id">
            <view class="list-item">
                <view class="u-flex u-flex-between">
                    <view>卡类型</view>
                    <view>
                        <u-radio-group v-model="cardType" placement="row">
                            <u-radio :disabled="true" :customStyle="{ marginRight: '16rpx' }" v-for="item in cardList"
                                :key="id" :label="item.name" :name="item.id" activeColor="#f34b47">
                            </u-radio>
                        </u-radio-group>
                    </view>
                </view>
            </view>
            <view class="list-item">
                <view class="u-flex u-flex-between">
                    <view>姓名</view>
                    <view>
                        {{ person.name || '' }}
                    </view>
                </view>
            </view>
            <view class="list-item">
                <view class="u-flex u-flex-between">
                    <view>性别</view>
                    <view>
                        {{ sexParam(person.sex) }}
                    </view>
                </view>
            </view>
            <view class="list-item">
                <view class="u-flex u-flex-between">
                    <view>联系方式</view>
                    <view>
                        {{ person.tel || '' }}
                    </view>
                </view>
            </view>
            <view class="list-item" v-if="person.idcard">
                <view class="u-flex u-flex-between">
                    <view>身份证号</view>
                    <view>
                        {{ person.idcard || '' }}
                    </view>
                </view>
            </view>
        </view>

    </view>
</template>
<script setup>
import { ref, reactive,computed } from "vue"
import { getFcInfoApi } from "@/api/index"
import { onLoad, onShow } from "@dcloudio/uni-app"
let personArr = ref([])
let searchInfo = ref('')
let cardType = ref('')
let cardList = ref([
    {
        name: "主卡",
        id: 1,
    },
    {
        name: "副卡",
        id: 0,
    },
]);
const sexParam = computed((sex)=>{
    return function(sex){
        let flag = Number.isNaN(+sex)
        if(flag){
            return sex
        }else{
           return sex==0?'女':'男'
        }
    }
})
const getInfo = () => {
    getFcInfoApi({
        zkfk: cardType.value,
        searchInfo: searchInfo.value
    }).then(res=>{
        if(res.success){
            personArr.value = res.data
        }
    })
}
onLoad((param) => {
    
    if (param.isZk == 1) {
        cardType.value = 1
        searchInfo.value = param.idcard
    } else {
        cardType.value = 0
        searchInfo.value = param.dzkTel
    }
    getInfo()
})
</script>
<style lang="scss"></style>